/**
 * Created by henian.xu on 2019/2/26.
 * vue 构建配置文件
 */

const webpackConfig = require('./webpack.config');

const isDev = process.env.NODE_ENV === 'development';

module.exports = {
  lintOnSave: undefined,

  devServer: {
    port: 7061,
    disableHostCheck: true,
    // https: true,
    proxy: {
      '/api': {
        // 系统资源
        target: 'http://testtongji.supersonicwx.com/',
        changeOrigin: true,
        pathRewrite: {
          '^/api': '/api',
        },
      },
    },
  },

  css: {
    sourceMap: true,
    loaderOptions: {
      sass: {
        additionalData: `@import "assets/style/_index.scss";`,
      },
    },
  },

  chainWebpack: (config) => {
    config.module
      .rule('vue')
      .use('vue-loader')
      .loader('vue-loader')
      .tap((options) => {
        // eslint-disable-next-line no-param-reassign
        options.compilerOptions.whitespace = 'preserve';
        return options;
      });
  },
  transpileDependencies: isDev
    ? []
    : ['swiper', 'dom7', 'ssr-window', 'resize-detector'],

  configureWebpack: webpackConfig,
};
